<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../static/css/Write_chapter.css">
    <script charset="utf-8" src="../static/js/kindeditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="../static/js/kindeditor/lang/zh-CN.js"></script>
    <script src="/static/jquery.min.js"></script>
    <script>
        KindEditor.ready(function (K) {
            window.editor = K.create('#editor_id', {
                width: '1050',
                height: '800',
                resizeType: '0',
                newlineTag: "br",
                uploadJson: "/kuyue/img/",
                items: ["fontname", "fontsize", "forecolor", "bold", "italic", "underline", "lineheight", "source", "redo", "undo", "indent", "outdent"],
            });
        });

        $(document).ready(function () {
            $("#form1").bind("submit", function () {
                var txt_firstname = $.trim($("#name1").val());
                var txt_lastname = editor.html();
                if (txt_firstname == "") {
                    $("#firstnameLabel").text("名称不能为空！");
                    $("#firstnameLabel").css({"color": "red"});
                    return false
                }
                else {
                    $("#firstnameLabel").text("")
                }
                if (editor.html().length == 0) {
                    $("#firstnameLabe2").text("内容不能为空！");
                    $("#firstnameLabe2").css({"color": "red"});
                    return false
                }
                else {
                    $("#firstnameLabe2").text("")

                }
            })
        })

    </script>
</head>
<body>
<div class="container">
    <header>
        <iframe src="/Header/" width="1200px" FrameBorder="0" height="135px"></iframe>
    </header>
    <div id="content">
        <div style="margin:50px">
            <form id="form1" action="/Update_chapter/?book_id={{ book_id }}" method="post">
                <div><span style="font-size: 18px">章节名称：</span></div>
                <input style="width: 300px;height: 30px" name="name" id="name1" type="text" value="{{ chapter_list.chapter_name }}"/>
                <label id="firstnameLabel"></label>
                <div style="width: 130px;margin-top: 10px"><span style="font-size: 18px">章节内容：</span></div>
                <div style="margin-top: 10px"><textarea id="editor_id"
                                                        name="content">{{ chapter_list.chapter_content }}</textarea>
                </div>
                <label id="firstnameLabe2"></label>
                <div style="margin-top: 10px"><input id="tijiao" style="width: 80px;height: 30px"
                                                     type="submit" value="提交"></div>
            </form>
        </div>
    </div>
</div>

</body>
</html>